package day08;

public abstract class Staff {
    private int id;
    private String name;

    public Staff(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    void eat() {
        System.out.println(name+"吃饭");
    }

    public abstract void work();
}

class Teacher extends Staff {
    public Teacher(int id, String name) {
        super(id, name);
    }

    public void work(){
        System.out.println(getName()+getId()+"号讲课");
    };
}

class Programmer extends Staff {
    public Programmer(int id, String name) {
        super(id, name);
    }

    public void work(){
        System.out.println(getName()+getId()+"号讲代码");
    };
}

class Networker extends Staff {
    public Networker(int id, String name) {
        super(id, name);
    }

    public void work(){
        System.out.println(getName()+getId()+"号拉网线");
    };
}
class Main{
    public static void main(String[] args) {
        Staff staff=new Staff(001,"张三") {
            @Override
            public void work() {
                System.out.println(getId()+getName());
                System.out.println("匿名内部类");
            }
        };
        staff.eat();staff.work();
        Teacher teacher=new Teacher(1001,"教师");
        Programmer programmer=new Programmer(1002,"程序员");
        Networker networker=new Networker(1003,"网管");
        teacher.eat();teacher.work();
        programmer.eat();programmer.work();
        networker.eat();networker.work();
    }
}
